Assert that group0/group1 counter config is what we expect
authorDimitris Papastamos <[email protected]>
Tue, 20 Feb 2018 11:16:44 +0000 (11:16 +0000)
committerDimitris Papastamos <[email protected]>
Tue, 27 Feb 2018 12:05:59 +0000 (12:05 +0000)
Before suspend the AMU counters should be enabled and after resume
they should be disabled.  Assert that to be consistent with the
AArch64 implementation of `amu_context_{save,restore}()`.

Change-Id: Ia46f77e4062b93afb93721a2890a9b9d2a7f300e
Signed-off-by: Dimitris Papastamos <[email protected]>
lib/extensions/amu/aarch32/amu.c

index 68cc4b34c8523d898e7d4ca917dad7dec4b7dd03..6898f756ed705533b2b94d972fbc7b5cbec2364a 100644 (file)
@@ -109,7 +109,8 @@ static void *amu_context_save(const void *arg)
        ctx = &amu_ctxs[plat_my_core_pos()];
 
        /* Assert that group 0 counter configuration is what we expect */
-       assert(read_amcntenset0() == AMU_GROUP0_COUNTERS_MASK);
+       assert(read_amcntenset0() == AMU_GROUP0_COUNTERS_MASK &&
+              read_amcntenset1() == AMU_GROUP1_COUNTERS_MASK);
 
        /*
         * Disable group 0 counters to avoid other observers like SCP sampling
@@ -141,7 +142,7 @@ static void *amu_context_restore(const void *arg)
        ctx = &amu_ctxs[plat_my_core_pos()];
 
        /* Counters were disabled in `amu_context_save()` */
-       assert(read_amcntenset0() == 0);
+       assert(read_amcntenset0() == 0 && read_amcntenset1() == 0);
 
        /* Restore group 0 counters */
        for (i = 0; i < AMU_GROUP0_NR_COUNTERS; i++)